package com.gxzy.util.jdbc;

/**
 * @ClassName: PageList
 * @Deprecated: 分页对象封装
 * @Author: 胡隆河
 * @Date: 2020/3/21 9:48
 **/

import lombok.*;

import java.util.ArrayList;
import java.util.List;

/**
 * 封装分页对象
 **/

public class PageList<T> {
    private long page;   //当前页
    private long totalRows;   //总行数
    private int pages;    //总页数
    private List<T> list = new ArrayList<>();

    public long getPage() {
        return page;
    }

    public void setPage(long page) {
        this.page = page;
    }

    public int getPages() {
        return pages;
    }

    public void setPages(int pages) {
        this.pages = pages;
    }

    public List<T> getList() {
        if (list == null) {
            list = new ArrayList<>();
        }
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }

    public long getTotalRows() {
        return totalRows;
    }

    public void setTotalRows(long totalRows) {
        this.totalRows = totalRows;
    }

    @Override
    public String toString() {
        return "PageList{" +
                "page=" + page +
                ", totalRows=" + totalRows +
                ", pages=" + pages +
                ", list=" + list +
                '}';
    }
}